package com.jjs.jcenterdemo;

import android.app.Application;

import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

/**
 * Created by yutf on 2018/2/25 0025.
 */

public class App extends Application
{
    RefWatcher refWatcher;

    static App instance;

    @Override
    public void onCreate()
    {
        super.onCreate();
        instance = this;
        refWatcher = setupLeakCanary();
    }

    private RefWatcher setupLeakCanary()
    {
        if (LeakCanary.isInAnalyzerProcess(this))
        {
            return RefWatcher.DISABLED;
        }
        return LeakCanary.install(this);
    }

    public RefWatcher getRefWatcher()
    {
        return refWatcher;
    }

    public static App getInstance()
    {
        return instance;
    }
}
